<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Image Upload</title>
</head>
<body>

	<div id="wrapperHeader">
		<div id="header">
			<img src="background/brand_claim_de.png" alt="logo" />
		</div>
	</div>

	<div id="navi">

		<ul>
			<li><a href="Home.jsp">Home</a></li>
			<li><a href="FileUploadForm.jsp">Upload a File</a></li>
			<li><a href="folders">Images</a></li>
		</ul>

	</div>


	<div id="content">

		Here you can browse all pictures and see all folders


		<form action="folder" method="post" enctype="multipart/form-data">
			<ul>
				<c:forEach var='item' items='${folderContent}'>

					<li>
						<form action="deleteFile" method="post"
							enctype="application/x-www-form-urlencoded">
							<c:choose>
								<c:when test="${item.isDirectory()}">
									<a href="folders?dirPath=${item.getPath()}"> <c:out
											value="${item.getFileName()}"></c:out>
									</a>
								</c:when>
								<c:otherwise>
									<a href="${item.getPath()}"> <c:out
											value="${item.getFileName()}"></c:out>
									</a>
								</c:otherwise>
							</c:choose>

							<input type="hidden" name="fileToDelete"
								value="${item.getPath()}" /> <input type="submit"
								value="delete" />
						</form>
					</li>
				</c:forEach>
				<c:if test="${fn:length(folderContent) == 0}">
					<li>This folder is empty</li>
				</c:if>

				<c:if test="${superDir!=null}">
					<li><a href="folders?dirPath=${superDir}">..</a></li>
				</c:if>
			</ul>
			<br /> <br />
		</form>

		<form action="createFolder" method="post"
			enctype="application/x-www-form-urlencoded">
			<input type="text" name="folderName" /> <input type="hidden"
				name="currentDir" value="${currentDir}" /> <input type="submit"
				value="create Folder" />
		</form>

	</div>





	<div id="footer">
		<img src="background/footer_bg_12.gif" alt="footer" />
	</div>

</body>
</html>